package com.example.myapplication2;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Vibrator;

public class StaticReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        //接收判定意图是否为StaticBroadcast的广播
        if (intent!=null&&intent.getAction().equals("StaticBroadcast")){
            System.out.println("接收到");
            Vibrator systemService = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
            systemService.vibrate(500);
        }
    }
}
